/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package presentation.controller;

import entity.ClassGroup;
import java.util.ArrayList;
import java.util.List;
import logic.facade.GradesFacade;
import logic.facade.SubjectFacade;
import vo.GradesVO;
import vo.IValueObject;
import vo.SubjectVO;

/**
 *
 * @author Joanna 8a
 */
public class ControlPanelNotes {

    public List<IValueObject> findGrades(String username) {
        return new GradesFacade().findByUser(username);
    }

    public List<String> showSubjects(String u) {
        List<SubjectVO> sub = new SubjectFacade().getSubjectsByUser(u);
        List<String> names = new ArrayList<>();

        for (SubjectVO s : sub) {
            names.add(s.getName());
        }

        return names;
    }

    public List<SubjectVO> getSubjectsByUser(String us) {
        return new SubjectFacade().getSubjectsByUser(us);
    }

    public List<GradesVO> gradesList(String user, Integer subjCode) {
        return new GradesFacade().gradesList(user, subjCode);
    }

    public ClassGroup userSubjectGroup() {
        ClassGroup classGroup = new ClassGroup();

        return classGroup;
    }

    public String addGrade(GradesVO grade) {
        new GradesFacade().create(grade);
        return "OK";
    }

    public boolean deleteGrade(int gradeId) {
        return new GradesFacade().delete(gradeId);
    }

    public GradesVO findGrade(int gradeId) {
        return (GradesVO) new GradesFacade().find(gradeId);
    }

    public boolean updateGrade(GradesVO grade) {
        return new GradesFacade().update(grade);
    }
}
